package com.stox.ui.javafx.core.application;

import javafx.scene.control.Tab;
import javafx.scene.layout.TilePane;

import org.springframework.context.ApplicationContext;

import com.stox.dto.intf.Application;

public abstract class AbstractApplicationTab extends Tab{

	protected TilePane contentPane = new TilePane();
	
	protected ApplicationContext applicationContext;
	
	public AbstractApplicationTab() {
		setClosable(false);
		contentPane.setId("apps-content-pane");
		setContent(contentPane);
		int flowPaneSize = 430;
		contentPane.setMaxSize(flowPaneSize, flowPaneSize);
		contentPane.setMinSize(flowPaneSize, flowPaneSize);
		contentPane.setPrefSize(flowPaneSize, flowPaneSize);
	}
	
	protected void addApplication(Application application){
		ApplicationPane applicationPane = (ApplicationPane)applicationContext.getBean("applicationPane", application);
		contentPane.getChildren().add(applicationPane);
	}
	
}
